package hashTable;

import java.util.Iterator;

public class MyLinkedListIterator<T> implements Iterator<T> {
    private MyLinkedNode<T> node;

    public MyLinkedListIterator(MyLinkedNode<T> node) {
        this.node = node;
    }

    @Override
    public boolean hasNext() {
        return node.getNext()!=null;
    }

    @Override
    public T next() {
        node = node.getNext();
        T element = node.getElement();
        return element;
    }
}
